package com.qf.microuser.user.controller;

import com.qf.common.core.annopation.NoLoginCheck;
import com.qf.common.core.common.R;
import com.qf.common.core.entity.User;
import com.qf.microuser.user.service.UserService;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * --- 缘分让我们相遇乱世以外 ---
 *
 * @author SJY
 * 2024/12/27
 */
@RestController
@Validated
public class AddLoginController {
    @Resource
    private UserService userService;

    /**
     * 用户注册
     */
    @NoLoginCheck
    @PostMapping("/LoginPage/AddLogin")
    public R addLogin(User user){
        userService.addLogin(user);
        return R.ok();
    }

    /**
     * 发送验证码
     */
    @NoLoginCheck
    @GetMapping("/SMSCode/GetCode")
    public R sendCode(String phone) {
        String code = userService.sendCode(phone);
        return R.ok(code);
    }

}
